home *** CD-ROM | disk | FTP | other *** search
Wrap
global gPlayerName, gGameLevel, gPlayerTips, gHighScores, gMaxHiScores, gGameSetup, gGameLevelStartTime, gPlayerTipsThisLevel, gGameLevelTime, gDrinksServedThisLevel, gDemoVersion on continueGame global gGameLevelStartTime, gPauseState if inBonusMode() then if gDemoVersion then go("Main Menu") exit end if gPauseState = 0 startBonusMode() if inShotMode() then returnToBar(#shot) else gotoBonusRound() end if exit end if resetForcedCharacterTimer() if inGameMode() then startNextLEvel() if gDemoVersion and (gGameLevel > 1) then go("Main Menu") exit end if gGameLevelStartTime = elapsedTime(gGameLevelTime) returnToBar(#game) newCharacterEnters(#Always) else if gDemoVersion then go("Main Menu") exit end if gGameLevel = 0 startNewGame() startNextLEvel() gGameLevelStartTime = now() returnToBar(#recipe) newCharacterEnters(#Always, VOID, 2) end if restoreWindowState() pullWindowsForward() end on restartGameLevel global gBounceInProgress, gNewLevel, gPauseState, gPauseTime, gGameLevelTime, gGameLevelStartTime gPauseTime = 0 gPauseState = 0 reinitializeCharacters() reinitializeBarTopManager() waitCursor() readInData() refreshTipRegister() gGameLevelStartTime = elapsedTime(gGameLevelTime) gNewLevel = 0 playTrack() resetCursor() end on restartBonusRound global gPauseState, gPauseTime, gBonusLimit, gBonusStartTime, gGameLevelTime gPauseTime = 0 gPauseState = 0 gBonusStartTime = elapsedTime(gGameLevelTime) playTrack() refreshTipRegister(VOID, 1) waitCursor() readInData() resetCursor() end on startNextLEvel global gBounceInProgress, gNewLevel, gServedUnderage, gPauseState, gPauseTime, gRecipeWindowOpenTime, gTotalAccuracy, gPlayerCardWarnings, gWarnedAboutGlassesUnderBar, gPearlyGates, gUserQuitFlag, gCharChildren gPearlyGates = 0 gUserQuitFlag = 0 gWarnedAboutGlassesUnderBar = 0 gPlayerCardWarnings = 0 gServedUnderage = 0 gRecipeWindowOpenTime = 0 gTotalAccuracy = 0 gPauseTime = 0 gPauseState = 0 gNewLevel = 1 gGameLevel = gGameLevel + 1 if gGameLevel > 1 then setLevelCurrentSong() end if reinitializeBarTopManager() repeat with persistentPatron in gCharChildren mSoberUp(persistentPatron) end repeat repeat with X = 9 to 20 sendSprite(X, #beginSprite) end repeat emptyGlasses(1) repeat with X = 78 to 89 sendSprite(X, #beginSprite) sendSprite(X, #mRemoveDrink) end repeat gBounceInProgress = 0 gPlayerTipsThisLevel = 0 refreshTipRegister() gDrinksServedThisLevel = 0 gGameLevelTime = 0 if gGameLevel > count(gGameSetup) then endOfGame() abort() end if end on beyondMaxTips global gPlayerTipsThisLevel if (gPlayerTipsThisLevel >= currentLevel(#MAXEARLYTIPS)) and inGameMode() then return 1 else return 0 end if end on beyondMinTips factor global gPlayerTipsThisLevel if voidp(factor) then factor = 1.0 end if if (gPlayerTipsThisLevel >= (currentLevel(#MINTIPS) * factor)) and inGameMode() then return 1 else return 0 end if end on endOfLevel global gGameLevelStartTime, gLeftOverTime, gServedUnderage, gUserQuitFlag gLeftOverTime = max(0, timeLeftOnThisLevel()) waitForDraggingMIAW() beginPause() dismissAllCrap(inMixingMode()) menuMode(1) updateStage() if inBonusMode() then go("BonusSummary") else if inPracticeMode() or gServedUnderage or gUserQuitFlag then gotoRoundSummary() else if beyondMaxTips() then gotoRoundSummary() managerVO("U01", 1) else if beyondMinTips(1.5) then gotoRoundSummary() managerVO(randomFromList(["O01", "W02", "W03", "x03"]), 0) else if beyondMinTips() then gotoRoundSummary() managerVO("O02", 0) else gotoRoundSummary() managerVO("E05", 1) if gPlayerTipsThisLevel < (currentLevel(#MINTIPS) / 3) then managerVO("U03", 1) if gGameLevel = 1 then managerVO(randomFromList(["u07", "U10", "u14"]), 0) end if else managerVO(randomFromList(["U02"]), 0) end if end if end if end if end if end if gGameLevelStartTime = now() end on endOfGame global gUserQuitFlag, gLastSavedGameName beginPause() setLevelCurrentSong() if (gUserQuitFlag = 0) or (gLastSavedGameName = EMPTY) then eligible = 1 else eligible = 0 end if if inPracticeMode() or not eligible then exitGame(0) exit end if if gPlayerTips > 0 then newHi = checkHiScore(1) else newHi = 0 end if if newHi > 0 then updateHighScoreChart() dismissAllCrap(0) if heavenly(newHi) then showHeaven() else go("High Scores") end if else exitGame(0) end if end on heavenly newHi global gGameLevel, gGameSetup, gEasyHeaven, gPlayerTips, gMaxTips if (gGameLevel >= 5) and (newHi = 1) then return 1 else if gEasyHeaven and (gGameLevel >= 1) then return 1 else if gGameLevel > count(gGameSetup) then return 1 else if gPlayerTips >= gMaxTips then return 1 else return 0 end if end if end if end if end on showHeaven global gPearlyGates gPearlyGates = 1 closeDownTheShow() end on closeDownTheShow closeAllWindows(0) replaceDraggingAnything() go("WaitForPatrons") abort() end on hideDragRect global gDragRect, gActiveWindow gActiveWindow = the stage sprite(gDragRect).rect = rect(-10, -10, -5, -5) end on dismissAllCrap saveWindows stopPatronSounds() closeAllWindows(saveWindows) replaceDraggingAnything() the actorList = [] dismissToolTip(1) hideDragRect() end on storeLastIngredient ingredient global gLastIngredient, gRecoverLastIngredient gLastIngredient = ingredient if not isGlassNotBeer(ingredient) and not isVessel(ingredient) then gRecoverLastIngredient = ingredient end if end on replaceDraggingAnything global gXbottlePopup, gSodaGunPopup, gMatrixMode gMatrixMode = 0 stopSoundFX() replaceActiveBottle() replaceWellItem() sendSprite(gXbottlePopup, #mHidePopup) sendSprite(gSodaGunPopup, #mHidePopup) end on quitSequence global gGameLevel if gGameLevel = 0 then quitTheProjector() else quitGame() end if end on quitTheProjector answer = yesNoDialogBox("Are you sure you want to exit?", "Exit?", #question, #NO) if answer = #yes then go("Quit") end if end on exitGame saveWindows dismissAllCrap(saveWindows) go("Main Menu") end on removeGarnish global gBarTopManager barGlass = getActiveGlass() if barGlass <> 0 then barSlot = glassSpriteToBarSlot(barGlass.spriteNum) status = sprite(barSlotToSprite(barSlot)).pStatus if getOne([#serving, #served], status) then alertBeep() exit end if glassType = getBarTopGlass(gBarTopManager, barSlot) if glassType = #none then exit end if ungarnishedGlass = glassPrefix(glassType) & "_none" setBarTopGlass(gBarTopManager, barSlot, member(ungarnishedGlass), glassType, 1, VOID, #noGarnish) clickSound() end if end on emptyGlasses silent, mixingGlassesOnly, activeGlassOnly global gMixingVesselsList, gWastingLiquorWarnings admonish = 0 thisGlass = getActiveGlass() thisPatron = getActiveCharacter() if thisPatron = 0 then exit end if if not mixingGlassesOnly and (thisGlass <> 0) then if sprite(thisPatron).pStatus = #serving then alertBeep() exit end if if sendSprite(thisGlass, #mIsHoldingLiquor) > 0 then admonish = 1 end if sendSprite(thisGlass, #mEmptyGlass) sendSprite(thisGlass, #mDropIt) end if if not activeGlassOnly then repeat with X in gMixingVesselsList if sendSprite(X, #mIsHoldingLiquor) > 0 then admonish = 1 end if sendSprite(X, #mEmptyGlass) end repeat end if if admonish and not silent then gWastingLiquorWarnings = gWastingLiquorWarnings + 1 if gWastingLiquorWarnings = 1 then managerVO("R01") else if gWastingLiquorWarnings = 3 then gWastingLiquorWarnings = 0 end if end if end if resetPourMeter() end on checkHiScore recordIt, newScore global gPlayerTips if voidp(newScore) then newScore = gPlayerTips end if if newScore = 0 then return 0 end if repeat with X = 1 to count(gHighScores) if newScore > gHighScores[X][#tips] then exit repeat end if end repeat if X <= gMaxHiScores then if recordIt then gHighScores[X] = [#playerName: gPlayerName, #level: gGameLevel, #tips: newScore] if count(gHighScores) > gMaxHiScores then deleteAt(gHighScores, gMaxHiScores + 1) end if end if return X else return 0 end if end on formatHiScoreData addDollarSign if addDollarSign then dollarSign = "$ " tempText = EMPTY else tempText = fileVersion(#hiscore) & RETURN dollarSign = EMPTY end if repeat with X = 1 to min(gMaxHiScores, count(gHighScores)) put gHighScores[X][#playerName] & TAB & gHighScores[X][#level] & TAB & dollarSign & float(gHighScores[X][#tips]) & RETURN after dollarSign end repeat delete char -30000 of tempText return tempText end on updateHighScoreChart global gHighScoreFile hiScoreData = formatHiScoreData(0) success = saveGame(gHighScoreFile, hiScoreData, "Hi Score Data", "HiScores.RYE", "LChs BEER") end on retrieveHiScores global gHighScoreFile, gInText gHighScores = [] hiScoreData = retrieveFile(gHighScoreFile) if not voidp(hiScoreData) then gInText = hiScoreData if checkVersionString(#hiscore) then parseHiScoreData(gInText) end if end if end on parseHiScoreData userData oldDelimiter = the itemDelimiter the itemDelimiter = TAB gHighScores = [] numLines = the number of lines in userData repeat with X = 1 to min(gMaxHiScores, numLines) thisLine = userData.line[X] name = thisLine.item[1] level = integer(thisLine.item[2]) tips = value(thisLine.item[3]) gHighScores[X] = [#playerName: name, #level: level, #tips: tips] end repeat the itemDelimiter = oldDelimiter end on formatObjectives thisLevel global gGameSetup thisRound = gGameSetup[thisLevel] temp = "Get ready to mix some drinks! Earn at least the minimum tips in the allotted time to advance to the bonus round. Earn tips faster to advance early." & RETURN & RETURN temp = temp & "Maximum Time this shift:" & TAB & integer(ticksToMinutes(thisRound[#duration])) && "minutes" & RETURN temp = temp & "Minimum Tips to advance:" & TAB & "$" & float(thisRound[#MINTIPS]) & RETURN temp = temp & "Advance early if you earn:" & TAB & "$" & float(thisRound[#MAXEARLYTIPS]) return temp end